jsx3.require("tibco.admin.enterpriseAssets.EnterpriseAssetsTabInterface");

jsx3.lang.Class.defineClass("tibco.admin.enterpriseAssets.sReg.ServerRegPlugin",
        jsx3.lang.Object,
        [tibco.admin.enterpriseAssets.EnterpriseAssetsTabInterface],
        function (plugin) {
            plugin.instance = null

            plugin.prototype.init = function() {
                this.jsxsuper();
            }

            plugin.prototype.getNamespace = function() {
                return "tibco.admin";
            }

            plugin.prototype.destroyPlugin = function() {
                var iter = this.getPluginList().iterator();
                while(iter.hasNext()) {
                    iter.next().destroy();
                }
                this.getPluginList().clear();
            }

            plugin.prototype.initPlugin = function(obj) {
            }

            plugin.getInstance = function(args) {
                if(!this.instance) {
                    this.instance = new tibco.admin.enterpriseAssets.sReg.ServerRegPlugin();
                }
                return this.instance;
            }

            plugin.prototype.getComponentPath = function() {
                return  "tibco/admin/enterpriseAssets/sReg/component.xml"
            }

            plugin.prototype.loadComponent = function(parent) {
                var me = this;
                tibco.admin.Main.loadUIResourceAsync(parent, "tibco.admin", "tibco/admin/enterpriseAssets/sReg/ui/tab.xml", me, me.componentLoaded);
            }

            plugin.prototype.getTabText = function(parent) {
                return tibco.admin.Main.getServer().getDynamicProperty("@@ServerRegistration_20")
            }

            plugin.prototype.componentLoaded = function(objEvent) {
                if(objEvent.status == "SUCCESS") {
                    this.child = objEvent.obj;
                    var me = this;
                    this.child.handler = me;
                }
            }

            plugin.prototype.tabSelected = function() {
                this.child.tabSelected();
            }
        });